-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OCPBUGS-41184: GCP Validate Disk and Instance Type #9043
base: master
Are you sure you want to change the base?
Conversation
@barbacbd: This pull request references Jira Issue OCPBUGS-41184, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
Requesting review from QA contact: The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
/label platform/google |
/cc @bfournie |
/lgtm |
/label qe-approved |
@barbacbd: This pull request references Jira Issue OCPBUGS-41184, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
bcf1dbb
to
e68fbcb
Compare
New changes are detected. LGTM label has been removed. |
** Update the error text and the way that disks and instances are validated. Before, the error message was backwards on indicating if the instance type or the disk type was the problem. Now, the disk type is validated against the instance type (rather than the opposite).
e68fbcb
to
a729cb0
Compare
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@barbacbd: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
@barbacbd Is it possible to merge the PR and then back-port to 4.17 as soon? Thanks! |
This is the plan. I am waiting on reviews and labels from the team. |
diskTypes := []string{} | ||
ok := false | ||
if instanceType != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about inverting this if
?
diskTypes := []string{} | |
ok := false | |
if instanceType != "" { | |
if instanceType == "" { | |
// nothing to validate, our defaults are already valid | |
return nil | |
} |
acceptedInstanceTypes := sets.New(validInstanceTypes...) | ||
if !acceptedInstanceTypes.Has(family) { | ||
return field.NotSupported(fldPath.Child("type"), family, sets.List(acceptedInstanceTypes)) | ||
diskTypes, ok = gcp.DiskTypeToInstanceTypeMap[family] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
diskTypes, ok = gcp.DiskTypeToInstanceTypeMap[family] | |
diskTypes, ok := gcp.DiskTypeToInstanceTypeMap[family] |
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} |
|
||
if arch == types.ArchitectureARM64 && family != "t2a" { | ||
return field.InternalError(fldPath, fmt.Errorf("instance type %s requires %s architecture", instanceType, types.ArchitectureARM64)) | ||
if len(diskTypes) > 0 && diskType != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if len(diskTypes) > 0 && diskType != "" { | |
if diskType != "" { |
// DiskTypeToInstanceTypeMap contains a map where the key is the Disk Type, and the values are a list of | ||
// instance types that are supported by the installer and correlate to the Disk Type. | ||
// DiskTypeToInstanceTypeMap contains a map where the key is the Instance Type, and the | ||
// values are a list of disk types that are supported by the installer and correlate to the Instance Type. | ||
DiskTypeToInstanceTypeMap = map[string][]string{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name is now backwards, but I understand not wanting to rename it.
** Update the error text and the way that disks and instances are validated. Before, the error message was backwards on indicating if the instance type or the disk type was the problem. Now, the disk type is validated against the instance type (rather than the opposite).